package durst.def.calendar;

import java.sql.SQLException;
import java.util.Calendar;
import java.util.UUID;

import durst.data.Account;
import durst.data.Event;
import durst.data.UserCalendar;
import durst.data.dao.TestDaoFactory;
import durst.def.DefaultData;

public class DefaultEvent extends Event implements DefaultData<Event> {
	public DefaultEvent() {
		super();
	}

	@Override
	public Event create(boolean persist) throws SQLException {
		Event ret = new Event((Account) new DefaultAccount().create(persist),
				(UserCalendar) new DefaultUserCalendar().create(persist), UUID.randomUUID()
						.toString(), Calendar.getInstance().getTime(), Calendar.getInstance()
						.getTime(), false, Calendar.getInstance().getTime(), Event.RepeatFrequency.NONE, "");

		if (persist) {
			TestDaoFactory.createDao(Event.class).create(ret);
		}

		return ret;
	}
}
